package com.puyuba.puyuba.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.puyuba.puyuba.R;
import com.puyuba.puyuba.view.activity.ChatActivity;

/**
 * 选择需求dialog
 */

public class SelectDemandDialog extends Dialog {

    private RelativeLayout rlBg;
    private TextView tvZhiye;
    private TextView tvXueli;
    private ImageView ivClose;
    public SelectDemandDialog(Context context) {
        super(context, R.style.ContactDialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_select_demand_layout);
        initView();
        //初始化界面控件的事件
        initEvent();
    }

    /**
     * 初始化界面的确定和取消监听器
     */
    private void initEvent() {
        ivClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        rlBg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        tvZhiye.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if ( onClickBottomListener!= null) {
                    onClickBottomListener.initprofessionDialog();
                }
            }
        });
        tvXueli.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if ( onClickBottomListener!= null) {
                    onClickBottomListener.initdemandDialog();
                }
            }
        });
    }
    /**
     * 设置确定取消按钮的回调
     */
    public OnClickBottomListener onClickBottomListener;
    public SelectDemandDialog setOnClickBottomListener(OnClickBottomListener onClickBottomListener) {
        this.onClickBottomListener = onClickBottomListener;
        return this;
    }
    public interface OnClickBottomListener{

        public void initdemandDialog();

        public void initprofessionDialog();

    }
    private void initView() {
        rlBg = (RelativeLayout) findViewById(R.id.rl_bg);
        tvZhiye = (TextView) findViewById(R.id.tv_zhiye);
        tvXueli = (TextView) findViewById(R.id.tv_xueli);
        ivClose = (ImageView) findViewById(R.id.iv_close);
    }


}